<template>
  <div class="finishedChart" ref="finishedChart">

  </div>
</template>

<script>
  var echarts = require('echarts')
  export default {
    data() {
      return {
        data: [
          { value: 1048, name: '广州' },
          { value: 735, name: '山东' },
          { value: 580, name: '上海' },
          { value: 484, name: '北京' },
          { value: 300, name: '河南' }
        ]
      }
    },
    methods: {
      finishedChart() {
        var myChart = echarts.init(this.$refs.finishedChart)
        myChart.setOption({
          title:{
            test:'产成品库存情况'
          },
          dataset: {
            source: [
              ['score', 'amount', 'product'],
              [89.3, 58212, '构建AP-1'],
              [57.1, 78254, '构建AP-2'],
              
            ]
          },
          grid: { containLabel: true },
          xAxis: { name: 'amount' },
          yAxis: { type: 'category' },
          visualMap: {
            orient: 'horizontal',
            left: 'center',
            min: 10,
            max: 100,
            text: ['High Score', 'Low Score'],
            // Map the score column to color
            dimension: 0,
            inRange: {
              color: ['#65B581', '#FFCE34', '#FD665F']
            }
          },
          series: [
            {
              type: 'bar',
              encode: {
                // Map the "amount" column to X axis.
                x: 'amount',
                // Map the "product" column to Y axis
                y: 'product'
              }
            }
          ]
        })
      }
    },
    mounted() {
      this.finishedChart()
    },
  }

</script>
<style lang='scss' scoped>
  .finishedChart {
    width: 100%;
    height: 450px;
  }
</style>